﻿<UserControl x:Class="SelectTeamServer"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
  xmlns:tfs="clr-namespace:Microsoft.TeamFoundation.Client;assembly=Microsoft.TeamFoundation.Client"
  xmlns:local="clr-namespace:Hinshelwood.TFSHeatITSM"
  xmlns:Controlers="clr-namespace:Hinshelwood.TFSHeatITSM.Controlers"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  mc:Ignorable="d">
    <UserControl.Resources>
        <Style x:Key="ErrorTextBlockStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="Foreground" Value="#FFEE1010" />
            <Setter Property="Width" Value="Auto"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="FontFamily" Value="Calibri"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Background" Value="{x:Null}"/>
        </Style>
        <Style x:Key="WelcomeButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="Foreground" Value="#FFFFFF" />
            <Setter Property="Width" Value="Auto"/>
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="FontFamily" Value="Calibri"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border x:Name="bd" CornerRadius="3,3,3,3" Padding="5,0,0,0">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="pack://application:,,/Resources/Images/TeamServerIcon.png"></Image>
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" Margin="5,1,0,1"/>
                            </StackPanel>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsKeyboardFocused" Value="true"/>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter Property="Cursor" Value="Hand"/>
                                <Setter Property="Background" TargetName="bd" Value="#FF29367B"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <DataTemplate DataType="{x:Type tfs:TeamFoundationServer}">
            <Button Content="{Binding Name}" Style="{DynamicResource WelcomeButtonStyle}" CommandParameter="{Binding Name}" Command="Controlers:TeamSystemCommands.ChangeServerCommand"></Button>
        </DataTemplate>
        
        
    </UserControl.Resources>

    <!--Setup menu command bindings-->
    <!--<UserControl.CommandBindings>
        <CommandBinding Command="local:Commands.ChangeTeamServerCommand" Executed="ChangeTeamServerCommand_Executed"/>
    </UserControl.CommandBindings>-->

    <StackPanel>

        <!-- Header -->
        <Border Width="Auto" Padding="5,0,5,0" Opacity="0.8" x:Name="Header" Background="{DynamicResource WelcomeBackgroundBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="5,5,0,0" HorizontalAlignment="Stretch" >
            <StackPanel Orientation="Horizontal" Margin="5">
                <StackPanel Margin="5">
                    <TextBlock Padding="4,10,0,0" Text="Team Server" TextWrapping="Wrap" Foreground="{DynamicResource WelcomeHeaderFontColor}" FontSize="18" FontWeight="Bold" d:LayoutOverrides="Height" HorizontalAlignment="Left" Margin="3.5,0,0,2" VerticalAlignment="Bottom"/>
                    <TextBlock Padding="4,0,0,0" Text="Select" TextWrapping="Wrap" Foreground="{DynamicResource WelcomeHeaderFontColor}" FontSize="16" FontWeight="Bold" x:Name="HeaderTextBlock" d:LayoutOverrides="Height" HorizontalAlignment="Left" Margin="3.5,0,0,2" VerticalAlignment="Bottom"/>
                </StackPanel>
                <Rectangle Margin="5,5,5,5" Fill="{DynamicResource WelcomeHeaderBg}" Height="69" Width="150" HorizontalAlignment="Center" />
            </StackPanel>
        </Border>

        <!-- Content -->
        <Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1,1,1,1">
            <DockPanel Background="{DynamicResource InputBackgroundBrush}">
                <Label DockPanel.Dock="Top" Content="Servers" HorizontalAlignment="Left" VerticalAlignment="Top"  Margin="10,0,0,0" Foreground="#FFB5C8D8" />
                <TextBlock DockPanel.Dock="Bottom" Style="{DynamicResource ErrorTextBlockStyle}" x:Name="MessageBox"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="auto" Height="30" TextWrapping="Wrap" TextAlignment="Center">
                </TextBlock>
                <ScrollViewer Grid.Row="1" Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}" MinHeight="100" MaxHeight="100" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                    <ItemsControl MinHeight="50" x:Name="uxItems" ItemsSource="{Binding AvailableServers}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                </ScrollViewer>
            </DockPanel>
        </Border>

        <!-- Footer -->
        <Border Background="{DynamicResource BackgroundBrush}" Height="35" x:Name="Footer" Padding="5" Opacity="0.8" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1,0,1,1" CornerRadius="0,0,5,5">
            <StackPanel Orientation="Horizontal">
                <Button Content="Close" Command="Controlers:TeamSystemCommands.ChangeServerCommand"></Button>
            </StackPanel>
        </Border>

    </StackPanel>
</UserControl>
